/**
 * 登陆js
 */
function show_box(id) {
	jQuery('.widget-box.visible').removeClass('visible');
	jQuery('#' + id).addClass('visible');
}
function refreshCaptcha() {
	$("#captcha").attr("src", "captcha?" + new Date());
}
$(function() {
	$("#loginSubmit").on(
			"click",
			function() {
				$.post(contextPath + '/system/login', $("#loginForm")
						.serialize(), function(result) {
					if (result.operationState == "SUCCESS") {
						location.href = contextPath + "/system/main";
					} else {
						showMessage(result.data.reason);
						refreshCaptcha();
					}
				}, "json")
			});

	$("#rememberMeCheckBox").on("click", function() {
		$("#remember").val($(this).get(0).checked ? "true" : "false");
	});
	$(window).keydown(function(e){
		if(e.keyCode==13){
			$("#loginSubmit").click();
		}
	})
})